package com.forest.platform.service.example;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;

import java.net.InetAddress;
import java.net.UnknownHostException;

@SpringBootApplication
public class Application {
    public static void main(String[] args) throws UnknownHostException {
        ConfigurableApplicationContext applicationContext = SpringApplication.run(Application.class, args);
        Environment env = applicationContext.getEnvironment();
        String ip = InetAddress.getLocalHost().getHostAddress();
        String port = env.getProperty("server.port", "8080");
        String profiles = env.getProperty("spring.profiles.active", "");
        String path = env.getProperty("server.servlet.context-path", "");
        System.out.println("\n\t----------------------------------------------------------\n\t" +
                "Application  Application 启动成功. [" + profiles + "] Access URLs:\n\t" +
                "Local:    \t\thttp://localhost:" + port + path + "\n\t" +
                "swagger-ui(1): \thttp://" + ip + ":" + port + path + "/swagger-ui/index.html\n\t" +
                "swagger-ui(2): \thttp://" + ip + ":" + port + path + "/doc.html\n\t" +
                "----------------------------------------------------------");
    }
}
